install.packages("zoo")
install.packages("gridExtra")
install.packages("apsrtable")
install.packages("pastecs")

library(gtools)
library(foreign)
library(plyr)
library(RJSONIO)
library(xtable)
library(rdd)
library(zoo)
library(gridExtra)
library(apsrtable)
library(pastecs)

setwd("")
data<- read.dta("Pre-Reg FL Data 8.6.13.dta")
setwd("/Users/johnholbein/Documents/Work/Hillygus/Data")
data2<-read.csv("Florida Births by Day 1988 1.csv")

attach(data)
par(mfrow=c(1,2))
DCdensity<-DCdensity(days_from_2008_flipped, bin =1,  plot = TRUE, ext.out=TRUE)
abline(v=2.5,col=3,lty=3)
title(xlab="Proximity to Ineligibility 2008 (Days)", ylab="Density")

attach(data2)
lo <- loess(BIRTHS~NUMBER)
plot(zoo(BIRTHS,NUMBER), xlab="Proximity to Ineligibility 2008 (Days)", ylim=c(0:600), ylab="Florida Birth Trends")
xl <- seq(min(NUMBER),max(NUMBER), (max(NUMBER) - min(NUMBER))/1000)
lines(xl, predict(lo,xl), col='red', lwd=2)
abline(v=2.5,col=3,lty=3)


abline(v=2.5,col=3,lty=3)


